
//
//  MBTitleCell.m
//  发布求租
//
//  Created by MB__Lee on 2018/6/7.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "MBTitleCell.h"
@interface  MBTitleCell()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UITextField *contentField;

@property (weak, nonatomic) IBOutlet UILabel *redLabel;


@end

@implementation MBTitleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.redLabel.hidden = YES;
    self.contentField.tintColor = MB_mainColor;
    self.contentField.delegate = self;
    
    // Initialization code
}
-(void)setCMModel:(MBCommonCellModel *)CMModel{
    [super setCMModel:CMModel];
    
    
    if (CMModel.hasX) {
        self.redLabel.hidden = NO;
    }else{
        self.redLabel.hidden = YES;
    }
    
    self.nameLabel.text = CMModel.title;
    self.contentField.placeholder = CMModel.PHTest;
    
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return  YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
    
    self.CMModel.sourceTitle = textField.text;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
